#!/bin/sh
# postrm script for openmediavault-dhcpd
#
# $Id: postrm 5 2011-11-03 11:57:25Z imooreyahoo@gmail.com $
#

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then

	if [ "$1" = "purge" ]; then
		if omv_config_exists "//services/dhcpd"; then
			xmlstarlet ed -P -L -d "//services/dhcpd" ${OMV_CONFIG_FILE}
		fi
	fi

	/etc/init.d/isc-dhcp-server stop
	update-rc.d isc-dhcp-server disable

fi

exit 0
